package com.example.service.impl;

import com.example.mapper.OperateLogMapper;
import com.example.pojo.OperateLog;
import com.example.service.OperateLogService;
import com.example.vo.report.GetAllLogs;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperateLogServiceImpl implements OperateLogService {
    @Autowired
    private OperateLogMapper operateLogMapper;
    @Override
    public GetAllLogs getAllLogs(Integer page, Integer pageSize) {
        PageHelper.startPage(page, pageSize);
        List<OperateLog> operateLogs = operateLogMapper.getAll();
        Page<OperateLog> p = (Page<OperateLog>) operateLogs;


        return new GetAllLogs(p.getTotal(), p.getResult());
    }
}
